﻿using LeRenard.Core.Web.Mailing;
using System.Net.Mail;

namespace LeRenard.Core.Web.Net45.Mailing
{
    /// <summary>
    /// Implementation of <see cref="IMailer"/>,
    /// which defines a mailer,
    /// specialised in sending HTML mails.
    /// </summary>
    public class HtmlMailer : Mailer
    {
        /// <summary>
        /// Constructs a new <see cref="HtmlMailer"/> instance.
        /// </summary>
        /// <param name="smtpClient">The <see cref="SmtpClient"/> to use as mail engine.</param>
        /// <param name="sender">The <see cref="MailAddress"/> to use as sender.</param>
        public HtmlMailer(SmtpClient smtpClient, MailAddress sender)
            : base(smtpClient, sender)
        {
        }

        /// <summary>
        /// Gets the base <see cref="MailMessage"/>.
        /// </summary>
        /// <returns>A base <see cref="MailMessage"/>.</returns>
        protected override MailMessage GetBaseMessage()
        {
            var baseMessage = base.GetBaseMessage();
            baseMessage.IsBodyHtml = true;

            return baseMessage;
        }
    }
}
